package com.yuluke.ylsaudiorecorder.record;

import android.os.Bundle;
import android.widget.Button;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.yuluke.ylsaudiorecorder.R;

public class RecordActivity extends AppCompatActivity {

    private static final String TAG = "YlsRec_Activity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_record);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        initViews();
        setUpRecordConfig();
    }

    private void initViews() {
        Button button = findViewById(R.id.button_start);
        button.setOnClickListener(v -> RecordService.startRecord(this));
        button = findViewById(R.id.button_stop);
        button.setOnClickListener(v -> RecordService.stopRecord(this));
    }

    private void setUpRecordConfig() {
        RecordConfig.getInstance().setUp();
    }


}